import request from '@/router/axios';
import {downloadExcel} from '@/router/axios';
import {formatCondition} from '@/util/util';
//单条查询
export const queryGeneralBizDemand = (params) => {
  params.head.transCode = 'queryGeneralBizDemand';
  return request({
    url: '/general/generalBizDemand/queryGeneralBizDemand',
    method: 'post',
    data: params
  })
}
//多条列表查询，支持条件查询
export const queryGeneralBizDemandListPage = (params) => {
  params.head.transCode = 'queryGeneralBizDemandListPage';
  return request({
    url: '/general/generalBizDemand/queryGeneralBizDemandListPage',
    method: 'post',
    data: params
  })
}
//新增单条记录
export const saveGeneralBizDemand = (params) => {
  params.head.transCode = 'saveGeneralBizDemand';
  return request({
    url: '/general/generalBizDemand/saveGeneralBizDemand',
    method: 'post',
    data: params
  })
}
//新增多条记录
export const saveGeneralBizDemandList = (params) => {
  params.head.transCode = 'saveGeneralBizDemandList';
  return request({
    url: '/general/generalBizDemand/saveGeneralBizDemandList',
    method: 'post',
    data: params
  })
}
//新增或修改单条记录
export const saveOrUpdateGeneralBizDemand = (params) => {
  params.head.transCode = 'saveOrUpdateGeneralBizDemand';
  return request({
    url: '/general/generalBizDemand/saveOrUpdateGeneralBizDemand',
    method: 'post',
    data: params
  })
}


//新增或修改单条记录
export const saveOrUpdateGeneralBizDemandList = (params) => {
  params.head.transCode = 'saveOrUpdateGeneralBizDemandList';
  return request({
    url: '/general/generalBizDemand/saveOrUpdateGeneralBizDemandList',
    method: 'post',
    data: params
  })
}

//修改单条记录
export const updateGeneralBizDemand = (params) => {
  params.head.transCode = 'updateGeneralBizDemand';
  return request({
    url: '/general/generalBizDemand/updateGeneralBizDemand',
    method: 'post',
    data: params
  })
}

//删除单条记录
export const deleteGeneralBizDemand = (params) => {
  params.head.transCode = 'deleteGeneralBizDemand';
  return request({
    url: '/general/generalBizDemand/deleteGeneralBizDemand',
    method: 'post',
    data: params
  })
}

//删除多条记录
export const deleteGeneralBizDemandList = (params) => {
  params.head.transCode = 'deleteGeneralBizDemandList';
  return request({
    url: '/general/generalBizDemand/deleteGeneralBizDemandList',
    method: 'post',
    data: params
  })
}
//导出excel
export const exportGeneralBizDemandExcel = (params) => {
  downloadExcel({
    url: '/general/generalBizDemand/excelDownload/exportGeneralBizDemandExcel',
    method: 'get',
    data: 
    {
      tenantId: params.head.tenantId,
      orders:'',
      condition: formatCondition(params.body.sqlCondition)
    }
  })
}
